package controllers;

import play.*;
import play.data.validation.InFuture;
import play.mvc.*;
import play.utils.Utils.AlternativeDateFormat;

import java.text.ParseException;
import java.util.*;

import models.*;

public class Application extends Controller {

	public static void index() {
		render();
	}

	public static void deleteUser(List<Long> ids) {
		notFoundIfNull(ids);
		for (long id : ids) {
			User.findById(id)._delete();
		}
		delete();
	}

	public static void delete() {
		List users = User.findAll();
		render(users);
	}

	public static void addUser(String firstName, String lastName,
			String address, String phoneNum, String password, String email,
			Date dateOfBirth) {

		@SuppressWarnings("unused")
		boolean lo = new User(firstName, lastName, address, phoneNum,
				password, email, dateOfBirth).validateAndCreate();

		validation.keep();
		register();
	}

	public static void register() {
		List l = User.findAll();
		User u = (User) (l.size()==0?null:l.get(l.size()-1));
		render(u);
	}

}